//
//  HKMonthPicker.h
//  HKProject
//
//  Created by 胡锦涛 on 2018/8/14.
//  Copyright © 2018年 胡锦涛. All rights reserved.
//

#import "HKBaseChooseView.h"
#ifndef IBInspectable
#define IBInspectable
#endif

@class HKBaseMonthPicker;

@protocol HKMonthPickerDelegate <NSObject>

@optional

- (void)monthPickerWillChangeDate:(HKBaseMonthPicker *)monthPicker selectedConponents:(NSDateComponents *)selectedConponents;

- (void)monthPickerDidChangeDate:(HKBaseMonthPicker *)monthPicker selectedConponents:(NSDateComponents *)selectedConponents;

@end

@interface HKBaseMonthPicker : UIPickerView<UIPickerViewDataSource, UIPickerViewDelegate>

@property (nonatomic, weak) id<HKMonthPickerDelegate> monthPickerDelegate;

//写入时忽略白天组件，在读取时设置为1。
@property (nonatomic, strong) IBInspectable NSDate* date;

/// The calendar currently being used
@property (nonatomic, strong, readonly) NSCalendar *calendar;

/// The minimum year that a month picker can show.
@property (nonatomic) IBInspectable NSInteger minimumYear;

/// The maximum year that a month picker can show.
@property (nonatomic) IBInspectable NSInteger maximumYear;

/// A Boolean value that determines whether the year is shown first.
@property (nonatomic) IBInspectable BOOL yearFirst;

/// A Boolean value that determines whether the month wraps
@property (nonatomic) IBInspectable BOOL wrapMonths;//一个布尔值，用于确定月份是否换行

/// A Boolean value that determines whether the current month & year are coloured.
@property (nonatomic) BOOL enableColourRow;//一个布尔值，用于确定当前月份和年份是否已着色。

/// en-US alias for `enableColourRow`.
@property (nonatomic, getter = enableColourRow, setter = setEnableColourRow:) IBInspectable BOOL enableColorRow;

/// Font to be used for all rows.  Default: System Bold, size 24.
@property (nonatomic, strong) UIFont *font;

/// Colour to be used for all "non coloured" rows.  Default: Black.
@property (nonatomic, strong) UIColor *fontColour;

/// en-US alias for `fontColour`.
@property (nonatomic, strong, getter = fontColour, setter = setFontColour:) IBInspectable UIColor *fontColor;

/// Selected Current Date Color.
@property (nonatomic, strong) UIColor *selectedDateColor;

-(id)init;

-(id)initWithDate:(NSDate *)date;

-(id)initWithDate:(NSDate *)date calendar:(NSCalendar *)calendar;

- (NSDate *)hk_pastYear:(NSInteger)pastYear;
@end


typedef void(^HKMonthResultBlock)(NSDateComponents *selectedComponents);

@interface HKMonthPicker : HKBaseChooseView
@property (nonatomic, copy)HKMonthResultBlock onTap ;

- (instancetype)initWithTitle:(NSString *)title defaultDate:(NSDate *)defaultDate minDateStr:(NSString *)minDateStr maxDateStr:(NSString *)maxDateStr isAutoSelect:(BOOL)isAutoSelect;
#pragma mark - 弹出视图方法
- (void)showWithAnimation:(BOOL)animation;
@end
